import Vue from 'vue'
import axios from 'axios'

axios.defaults.baseURL = '/api'

const HTTP = {
  get (url, params) {
    return axios.get(url, {
      params
    })
  },
  post (url, data) {
    return axios.post(url, data)
  },
  put (url, data) {
    return axios.put(url, data)
  },
  delete (url, params) {
    return axios.delete(url, {
      params
    })
  }
}
Vue.prototype.$http = HTTP

export default HTTP
